package com.wsf.main.controller;

import com.wsf.main.common.DateUtil;
import org.apache.commons.lang3.time.DateFormatUtils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class test {
    public static void main(String[] arg) throws ParseException {

        Calendar c = Calendar.getInstance();
        c.setTime(new Date());

        c.add(Calendar.HOUR, 1);
        System.out.println(c.getTime());
        String time = "2022-09-30 01:55:55";
        Date date = DateUtil.dateToISODate(time);
        System.out.println(date);

        String pattern = "YYYY-MM-dd'T'HH:mm:ss.000ZZ";
        System.out.println(DateFormatUtils.format(new Date(), pattern));
        System.out.println(dealDateFormat("2016-10-15T18:00:00.825+08:00"));
    }

    public static String dealDateFormat(String oldDateStr) throws ParseException {

     Date date12= cn.hutool.core.date.DateUtil.parse(oldDateStr);
        System.out.println(date12+"---");
        if(new Date().after(date12)){
            System.out.println("--------");
        }
//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");  //yyyy-MM-dd'T'HH:mm:ss.SSSZ
//        Date date = df.parse(oldDateStr);
//        SimpleDateFormat df1 = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
//        Date date1 = df1.parse(date.toString());
        SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(df2.format(date12));
//
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置格式
//        Calendar calendar = Calendar.getInstance(); //创建Calendar 的实例
//        calendar.setTime(date1);
//        calendar.add(Calendar.HOUR, 8); //当前时间减去一天
//        System.out.println("---" + simpleDateFormat.format(calendar.getTime()));

        return null;
    }
}

